package com.feng.show.controller;


import com.feng.show.comm.ServerResponse;
import com.feng.show.entity.UserInfo;
import com.feng.show.service.IUserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/user")
@RestController
public class LoginController {

    @Autowired
    private IUserLoginService userLoginService;




    @GetMapping("/doLogin")
    public ServerResponse<UserInfo>  doLogin(@RequestParam(value = "userName") String userName,   @RequestParam(value = "pwd") String pwd){


        if(userName==null||pwd==null){
            return ServerResponse.createBySuccessMsg("用户名或者密码错误");

        }else{
            System.out.println("用户名和密码："+userName+"--"+pwd);
            return userLoginService.doLogin(userName,pwd);
        }

    }
}
